﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace CILADA.Engine
{
    public static class ExtensionMethods
    {
        public static string BooltoYesNo(this bool truth)
        {
            return (truth) ? "yes" : "no" ;
        }

        public static string JoinWithPathSeparator(this string[] pathParts)
        {
            StringBuilder sb = new StringBuilder();
            foreach (string s in pathParts)
            {
                if ("".Equals(sb.ToString()))
                {
                    sb.Append(s);
                }
                else
                {
                    sb.Append(Path.DirectorySeparatorChar);
                    sb.Append(s);
                }
            }

            return sb.ToString();
        }

        public static string Repeat(this string text, int count)
        {
            if (count <= 0) return text;

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < count; i++)
            {
                sb.Append(text);
            }

            return sb.ToString();
        }
    }
}
